/*
 * @Author: your name
 * @Date: 2022-04-17 15:08:17
 * @LastEditTime: 2022-04-17 22:21:17
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \drivingApp\driving-app\src\api\user.js
 */
import request from '@/utils/request'
import { postJson,post,get,put} from '@/utils/request'
import { getToken,removeToken } from '@/utils/auth'
export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/user/getInfo',
    method: 'get',
  })
}

export function logout() {
   removeToken()
   location.reload()
}

export function getArticleList(data){
  return postJson('/article/getArticle',data)
}

export function addArticle(data){
  return postJson('/article/creatArticle',data)
}

export function delectArticle(data){
  return get(`/article/deleteArticle${data}`,"")
}

export function updataArticlStatus(data){
  return get(`/article/updataStatus${data}`,"")
}

export function cancelStatus(data){
  return get(`/article/cancelStatus${data}`,"")
}

export function getAllUser(data){
  return postJson('/user/getAllUser',data)
}
export function deleteUser(data){
  return get(`/user/deleteUser${data}`,"")
}
export function updateUser(data){
  return postJson('/user/updateUser',data)
}
export function getUserDeil(data){
  return get('/user/updateUser',data)
}
export function createUser(data){
  return postJson('/user/register',data)
}